/*!
    \copyright  Copyright (c) 2019 - 2025 Qualcomm Technologies International, Ltd.
                All Rights Reserved.
                Qualcomm Technologies International, Ltd. Confidential and Proprietary.
    \file       
    \addtogroup pairing
    \brief      Pairing plugin internal interface
    @{
*/

#ifndef PAIRING_PLUGIN_SM_H_
#define PAIRING_PLUGIN_SM_H_

#include "pairing.h"
#include <cm_lib.h>

typedef struct __pairing_plugin_context_t* pairing_plugin_context_t;

/*!
    \brief Reset plugin context to default values
 */
void Pairing_PluginSmContextInit(void);

/*!
    \brief Store remote IO capability indication for processing

    \param[in] ind The indication to store
    
    \return The context created for handling this indication
 */
pairing_plugin_context_t Pairing_PluginSmSetRemoteIoCapability(const CsrBtCmSmIoCapabilityResponseInd *ind);

/*!
    \brief Make all plugin callbacks for processing remote IO capability
    
    \param[in] context The context to retrieve the indication from to process
 */
void Pairing_PluginSmRemoteIoCapabilityCallbacks(pairing_plugin_context_t context);

/*!
    \brief Store CTKD indication for processing

    \param[in] ind The indication to store
    
    \return The context created for handling this indication
 */
pairing_plugin_context_t Pairing_PluginSmSetCtkdInd(const CmSmGenerateCrossTransKeyRequestInd* ind);

/*!
    \brief Retrieve CTKD indication for processing
    
    \param[in] context The context to retrieve the indication from
    \param[out] ind The indication retrieved

    \return TRUE if the indication was retrieved successfully, otherwise FALSE
 */
bool Pairing_PluginSmGetCtkdInd(pairing_plugin_context_t context, CmSmGenerateCrossTransKeyRequestInd* ind);


/*!
    \brief Make all plugin callbacks for processing CTKD
    
    \param[in] context The context to retrieve the indication from to process
    \param[out] ctkd_rsp The response generated by the plugin callbacks
    
    \return pairing_plugin_response_wait if any plugin is not ready to respond or
    pairing_plugin_response_abstain/pairing_plugin_response_update if all plugins 
    have responded
 */
pairing_plugin_rsp_t Pairing_PluginSmCtkdCallbacks(pairing_plugin_context_t context, pairing_ctkd_rsp_t* ctkd_rsp);

/*!
    \brief Store IO capability request indication for processing

    \param[in] ind The indication to store
    
    \return The context created for handling this indication
 */
pairing_plugin_context_t Pairing_PluginSmSetIoCapabilityRequestInd(const CsrBtCmSmIoCapabilityRequestInd* ind);

/*!
    \brief Retrieve IO capability request indication for processing
    
    \param[in] context The context to retrieve the indication from
    \param[out] ind The indication retrieved

    \return TRUE if the indication was retrieved successfully, otherwise FALSE
 */
bool Pairing_PluginSmGetIoCapabilityRequestInd(pairing_plugin_context_t context, CsrBtCmSmIoCapabilityRequestInd* ind);

/*!
    \brief Make all plugin callbacks for processing IO capability request
    
    \param[in] context The context to retrieve the indication from to process
    \param[out] io_capability_rsp The response generated by the plugin callbacks
    
    \return pairing_plugin_response_wait if any plugin is not ready to respond or
    pairing_plugin_response_abstain/pairing_plugin_response_update if all plugins 
    have responded
 */
pairing_plugin_rsp_t Pairing_PluginSmIoCapabilityRequestCallbacks(pairing_plugin_context_t context, pairing_io_capability_rsp_t* io_capability_rsp);

/*!
    \brief Store user confirmation indication for processing

    \param[in] ind The indication to store
    
    \return The context created for handling this indication
 */
pairing_plugin_context_t Pairing_PluginSmSetUserConfirmationInd(const CsrBtCmSmUserConfirmationRequestInd* ind);

/*!
    \brief Retrieve user confirmation indication for processing
    
    \param[in] context The context to retrieve the indication from
    \param[out] ind The indication retrieved

    \return TRUE if the indication was retrieved successfully, otherwise FALSE
 */
bool Pairing_PluginSmGetUserConfirmationInd(pairing_plugin_context_t context, CsrBtCmSmUserConfirmationRequestInd* ind);

/*!
    \brief Make all plugin callbacks for processing user confirmation
    
    \param[in] context The context to retrieve the indication from to process
    \param[out] user_confirmation_rsp The response generated by the plugin callbacks
    
    \return pairing_plugin_response_wait if any plugin is not ready to respond or
    pairing_plugin_response_abstain/pairing_plugin_response_update if all plugins 
    have responded
 */
pairing_plugin_rsp_t Pairing_PluginSmUserConfirmationRequestCallbacks(pairing_plugin_context_t context, pairing_user_confirmation_rsp_t* user_confirmation_rsp);

/*!
    \brief Store SSP complete indication for processing

    \param[in] ind The indication to store
    
    \return The context created for handling this indication
 */
pairing_plugin_context_t Pairing_PluginSmSetSspCompleteInd(const CsrBtCmSmSimplePairingCompleteInd *ind);

/*!
    \brief Retrieve SSP complete indication for processing
    
    \param[in] context The context to retrieve the indication from
    \param[out] ind The indication retrieved

    \return TRUE if the indication was retrieved successfully, otherwise FALSE
 */
bool Pairing_PluginSmGetSspCompleteInd(pairing_plugin_context_t context, CsrBtCmSmSimplePairingCompleteInd* ind);

/*!
    \brief Make all plugin callbacks for processing BR/EDR bond indication
    \brief Make all plugin callbacks for processing user confirmation
    
    \param[in] context The context to retrieve the indication from to process
    \param[out] bredr_bond_rsp The response generated by the plugin callbacks
    
    \return pairing_plugin_response_wait if any plugin is not ready to respond or
    pairing_plugin_response_abstain/pairing_plugin_response_update if all plugins 
    have responded
 */
pairing_plugin_rsp_t Pairing_PluginSmSspCompleteIndicationCallbacks(pairing_plugin_context_t context, pairing_ssp_complete_rsp_t* bredr_bond_rsp);

/*! 
    \brief Called when pairing completes to clear any state from pairing_plugin
 */
void Pairing_PluginSmPairingComplete(const tp_bdaddr* tp_addr);

#endif

/*! @} */
